package com.jt.proxy;

import com.jt.pojo.User;
import com.jt.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.jws.soap.SOAPBinding;

/**
 * @outhor fufeixiang
 * @date 2021-04-25
 */
@Service("userService")
public class StaticProxy implements UserService {
    @Autowired
    private UserService tar;
    @Override
    public void addUser(User user) {
        try {
            System.out.println("开启事务");
            tar.addUser(user);
            System.out.println("事务提交");
        }catch (Exception e){
            System.out.println("事务回滚");
        }
    }

    @Override
    public void delteUser(User user) {
        try {
            System.out.println("开启事务");
            tar.delteUser(user);
            System.out.println("事务提交");
        }catch (Exception e){
            System.out.println("事务回滚");
        }
    }
}
